using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DTO;
using DAO;

namespace BUS
{
    public class KhachHangBUS
    {
        #region TimThongTinKhachHangTheoTen
        public static DataTable TimThongTinKhachHangTheoTen(string TenKH)
        {
            DataTable dt = KhachHangDAO.TimThongTinKhachHangTheoTen(TenKH);
            return dt;
        }
        public static bool KiemTraTimThongTinKhachHangTheoTen(string TenKH)
        {
            bool KQ = false;
            if (KhachHangDAO.KiemTraTimThongTinKhachHangTheoTen(TenKH) == true)
            {
                KQ = true;
            }
            return KQ;
        }
        #endregion

        #region TimThongTinKhacHangTheoDiaDiem
        public static DataTable TimThongTinKhacHangTheoDiaDiem(string TenDiaDiem)
        {
            DataTable dt = KhachHangDAO.TimThongTinKhacHangTheoDiaDiem(TenDiaDiem);
            return dt;
        }
        public static bool KiemTraTimThongTinKhacHangTheoDiaDiem(string TenDiaDiem)
        {
            bool KQ = false;
            if (KhachHangDAO.KiemTraTimThongTinKhacHangTheoDiaDiem(TenDiaDiem) == true)
            {
                KQ = true;
            }
            return KQ;
        }
        #endregion

        #region TimThongTinKhacHangTheoDiaDiem
        public static DataTable TimThongTinKhacHangTheoMaKhachHang(string MaKH)
        {
            DataTable dt = KhachHangDAO.TimThongTinKhacHangTheoMaKhachHang(MaKH);
            return dt;
        }
        public static bool KiemTraTimThongTinKhacHangTheoMaKhachHang(string MaKH)
        {
            bool KQ = false;
            if (KhachHangDAO.KiemTraTimThongTinKhacHangTheoMaKhachHang(MaKH) == true)
            {
                KQ = true;
            }
            return KQ;
        }
        #endregion

        #region 1. Inserting KhachHang
        public static bool InsertKhachHang(KhachHangDTO kh)
        {
            if (KhachHangDAO.KiemTraNhapKhachHang(kh.MaKH) == true)
            {
                return false;
            }
            return KhachHangDAO.NhapKhachHang(kh);

        }
        #endregion


        public static DataTable LayThongTinKhachHang(string MaKH)
        {
            DataTable dt = KhachHangDAO.LayThongTinKhachHang(MaKH);
            return dt;
        }
    }
}
